import json

import requests

from plattest.testcases.user import get_token

v1 = "http://localhost:8080/manager/"


def get_policy():
    res = requests.get(v1 + "policy", headers={'token': get_token(user="admin")})
    res = json.loads(res.text)
    print(res)


def add_policy(sub, obj, act):
    res = requests.post(v1 + "policy", json={"sub": sub, "obj": obj, "act": act},
                        headers={'token': get_token(user="admin")})
    res = json.loads(res.text)
    print(res)


# add_policy("palmer", "*", "/")

get_policy()
